#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <signal.h>



#define BUFF_LEN 100

#include "mychar.h"

int fd = 0;
void signal_handler(int signo);
int main(int argc, char *argv[]){
	int flg = 0;
	int ret = 0;
	char buff[BUFF_LEN] = "";

	if(argc < 2){
		printf("too few arguments\n");
		return 1;
	}

	fd = open(argv[1], O_RDWR);

	if(fd < 0){
		printf("open failed : %s \n", argv[1]);
		return 2;
	}

	while(1){
		read(fd, buff, 4);
		printf("read buff %s\n", buff);
		memset(buff, 0, BUFF_LEN);

	}

	close(fd);
	return 0;
}
